package com.pig4cloud.pig.village.rules.runner;

import com.pig4cloud.pig.village.rules.service.IRuleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 项目启动时，自动加载规则引擎
 * @author lucien.li
 * @date 2021/8/6
 */
@Component
@Slf4j
public class RuleInitRunner implements CommandLineRunner {
	@Resource
	private IRuleService ruleService;
	@Override
	public void run(String... args) throws Exception {
		log.info("开始构建规则引擎");
		ruleService.initRulesEngine();
		log.info("规则引擎构建结束");
	}
}
